package web.servlet;

import service.UserService;
import service.impl.UserServiceImpl;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * 删除选中用户的信息
 *
 * @author Mc.Chai
 * @program: JavaWeb
 * @create 2022-04-03-10:57 10:57
 */
@WebServlet("/delSelectUserServlet")
public class DelSelectUserServlet extends HttpServlet {
    @Override
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        //获取选中用户的id数据(提交的数据中只有uid所以使用获取数组的方式)
        String[] parameterValues = request.getParameterValues("uid");
        UserService service=new UserServiceImpl();
        service.delSelectUser(parameterValues);
        response.sendRedirect(request.getContextPath()+"/findUserByPageServlet");
    }

    @Override
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        this.doPost(request, response);
    }
}
